package symbolrt.translation.parser.base;

import symbolrt.translation.parser.Token;

public class Element {

	private Token tk;

	public Element(Token tk) {
		if (tk != null)
			this.tk = tk;
		else
			this.tk = null;
	}

	public Token getToken() {
		return this.tk;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((tk == null) ? 0 : tk.image.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Element other = (Element) obj;
		if (tk == null) {
			if (other.tk != null)
				return false;
		} else if (!tk.image.equals(other.tk.image))
			return false;
		return true;
	}

	public String getName() {
		return this.getToken().image;
	}

	@Override
	public String toString() {
		return this.getToken().image;
	}
	
	
	

}
